//
//  ChannelLabel.m
//  WY
//
//  Created by lanou3g on 16/5/9.
//  Copyright © 2016年 pcc. All rights reserved.
//

#import "ChannelLabel.h"

#define HJBigFont 18.f
#define HJNormalFont 14.f
@implementation ChannelLabel

+(instancetype)channelLabelWithTitle:(NSString *)title {
    ChannelLabel *label = [[self alloc]init];
    label.text = title;
    label.font = [UIFont systemFontOfSize:HJBigFont];
    //调整视图。默认返回现有视图大小
    [label sizeToFit];
    //正常状态
    label.font = [UIFont systemFontOfSize:HJNormalFont];
    //启用用户交互
    label.userInteractionEnabled = YES;
    label.textAlignment = NSTextAlignmentCenter;
    return label;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    if (self.clickchannel) {
        self.clickchannel();
    }
}

- (void)setScale:(CGFloat)scale {
    CGFloat present = (CGFloat)(HJBigFont - HJNormalFont) / HJNormalFont;
    present = present * scale + 1;
    self.transform = CGAffineTransformMakeScale(present, present);
    self.textColor = [UIColor colorWithRed:present *scale green:0 blue:0 alpha:YES];
}

@end
